<template>
  <view>
    <view class="main">
      <view class="main_con">
        <view>头像</view>
        <view
          class="avatar_img"
          @click="openBig(baseUrl + DoctorDetils.headImage)"
        >
          <image
            :src="baseUrl + DoctorDetils.headImage"
            mode="aspectFill"
          ></image>
        </view>
      </view>
      <view class="main_con">
        <view>姓名</view>
        <view class="avatar_img">
          {{ DoctorDetils.name || "无" }}
        </view>
      </view>
      <view class="main_con">
        <view>所属工作站</view>
        <view class="avatar_img">
          {{ leveltoname(DoctorDetils.stationLvel) }}
        </view>
      </view>
      <view class="main_con">
        <view>所属医院</view>
        <view class="avatar_img">
          {{ DoctorDetils.hospitalName || "无" }}
        </view>
      </view>
      <view class="main_con">
        <view>所属科室</view>
        <view class="avatar_img">
          {{ DoctorDetils.departmentName || "无" }}
        </view>
      </view>
      <view class="main_con">
        <view>性别</view>
        <view class="avatar_img">
          {{ numtosex(DoctorDetils.gender) }}
        </view>
      </view>
      <view class="main_con">
        <view>行医时间</view>
        <view class="avatar_img">
          {{ DoctorDetils.doctorStartDate || "无" }}
        </view>
      </view>
      <view class="doctorjj">
        <view class="fontsize14 color999">简介</view>
        <view>
          {{ DoctorDetils.experience || "无" }}
        </view>
      </view>
      <view class="main_con">
        <view>从业资格证</view>
        <view
          class="avatar_img color3FA"
          @click="openBig(baseUrl + DoctorDetils.employmentImage)"
        >
          预览
        </view>
      </view>
      <view class="main_con">
        <view>医生资格证</view>
        <view
          class="avatar_img color3FA"
          @click="openBig(baseUrl + DoctorDetils.practitionerImage)"
        >
          预览
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { getDoctorDetils } from '../../api/index.js'
export default {
  data() {
    return {
      userinfo: {},
      userimg: {
      },
      DoctorDetils: {},
      baseUrl: ''
    }
  },
  onLoad(options) {
    this._getDoctorDetils(options.doctorId)
    this.baseUrl = this.$store.state.chronic.baseUrl
  },
  methods: {
    leveltoname(val) {
      let name = ''
      switch (val) {
        case '1':
          name = '一级工作站'
          break;
        case '2':
          name = '二级工作站'
          break;
        case '3':
          name = '三级工作站'
          break;
        default:
          name = '无'
          break;
      }
      return name
    },
    numtosex(val) {
      let name = ''
      switch (val) {
        case 1:
          name = '男'
          break;
        case 2:
          name = '女'
          break;
        default:
          name = '女'
          break;
      }
      return name
    },
    //获取医生详情
    _getDoctorDetils(doctorId) {
      getDoctorDetils({
        doctorId: doctorId
      }).then(res => {
        this.DoctorDetils = res.data
      })
    },
    //点击放大图
    openBig(checklistUrl) {
      var arr = [];
      arr[0] = checklistUrl
      uni.previewImage({
        urls: arr,
        current: 0
      });
    },
  }
}
</script>

<style>
.main {
  width: 90vw;
  margin: 0 auto;
}
.topdata {
  height: 96rpx;
  line-height: 96rpx;
  background-color: #f3f8ff;
  padding: 0 5%;
}
.leftimg image {
  width: 60rpx;
  height: 60rpx;
  margin-right: 12rpx;
  vertical-align: -15rpx;
}
.rightimg image {
  width: 48rpx;
  height: 48rpx;
  vertical-align: -15rpx;
}
.avatar_img {
  /* color: #333; */
}
.avatar_img image {
  width: 80rpx;
  height: 80rpx;
  margin-top: 12rpx;
}
.main_con {
  font-size: 28rpx;
  height: 104rpx;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2rpx solid #f7f7f7;
}
.main_con > view:first-child {
  width: 200rpx;
  color: #999;
}
.doctorjj {
  padding-top: 32rpx;
  display: flex;
  flex-direction: column;
}
.doctorjj > view:first-child {
  width: 150rpx;
}
.doctorjj > view:last-child {
  margin-top: 20rpx;
  font-size: 28rpx;
  border-bottom: 2rpx solid #f7f7f7;
  padding-bottom: 36rpx;
}
.titlecon {
  width: 100vw;
  height: 80rpx;
  line-height: 80rpx;
  background-color: #f7f7f7;
  position: relative;
  left: -5vw;
  padding: 0 5vw;
}
</style>
